#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

const int N = 110;

struct S
{
	int score;
	string name;
	
 } arr[N];
 
 bool cmp(struct S s1,struct S s2)
 {
 	return s1.score > s2.score;
 }
 int main()
 {
 	int n = 0;
 	cin >> n;
 	for(int i = 0; i< n; i++)
 	{
 		cin >> arr[i].score >> arr[i].name; 
	 }
 	sort(arr,arr + n,cmp);
 	cout << arr[0].name<<endl;
 	return 0;
 }
 
 
